#pragma once

#include <map>
#include <gtl/module/IModule.h>

#include "IExplorerPluginHost.h"

class CMPluginHost : public CModuleImpl<MPID(ExplorerPluginHost), IExplorerPluginHost>
{
public:
	CMPluginHost(void);
	virtual ~CMPluginHost(void);

public:
	// Override IPluginHost
	virtual LPPluginHostInfo GetInfo();

public:
	// Override IExplorerPluginHost
	virtual LPCTSTR ShowCopyAsDlg(const std::vector<CString>& vecFiles, bool bIsCopyTo);
	virtual HRESULT GetDirectory(LPTSTR* ppszDirectory, uint16 nCount, EDirectoryType eDirectoryType);

	virtual HRESULT RegisterCopyAsPath(LPCTSTR lpszDesc, ProcessFun Process, void* pUserData);
	virtual HRESULT UnregisterCopyAsPath(LPCTSTR lpszDesc);

public:
	// Override IModule
	virtual HRESULT Initialize();

public:
	void GetCopyAsPaths(std::vector<CString>& vecCopyAsPaths);
	void ProcessCopyAs(const CString& strDesc, const std::vector<CString>& vecFilePaths);

protected:
	SPluginHostInfo m_PluginHostInfo;
	typedef std::map<CString, std::pair<ProcessFun, void*> > MapProcessFunInfo;
	MapProcessFunInfo m_mapProcessCopyAsFun;
};
